import 'package:flutter/widgets.dart';

class MyWidgetsBindingObserver extends WidgetsBindingObserver {
  @override
  void didChangeAppLifecycleState(AppLifecycleState state) {
    super.didChangeAppLifecycleState(state);
    if(state == AppLifecycleState.resumed) {
      // 页面或组件可见
      print('页面或组件可见');
    } else {
      // 页面或组件不可见
      print('页面或组件不可见');
    }
  }
}